package com.suse.config;

import com.suse.util.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.ArrayList;
import java.util.List;

@Configuration
public class MyInterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        List<String> list = new ArrayList<>();
        //配置拦截index路径
        list.add("/index");
        //配置拦截info路径
        list.add("/info");
        //注册LoginInterceptor拦截器，配置拦截地址
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns(list);
    }
}